<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登录界面</title>
</head>
<link rel="stylesheet" href="http://localhost:8085/youxia/layui/css/layui.css">
<script src="http://code.jquery.com/jquery-3.1.1.min.js"></script>
<body style='background-image: url("http://localhost:8085/youxia/image/indexbg.jpeg")'>

<div style="top:50%;left:50%;transform: translate(-50%,-50%);position: absolute;">
    <form class="layui-form" action="http://localhost:8085/youxia/login" method="post" id="fs">
        <div class="layui-form-item">
            <div class="layui-inline">
                <div class="layui-input-inline">
                    <input type="tel" name="username" placeholder="用户名" autocomplete="off" class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <div class="layui-input-inline">
                    <input type="password" name="password" placeholder="密码" autocomplete="off" class="layui-input">
                </div>
            </div>

        </div>


        <div class="layui-form-item" pane="">
            <div class="layui-input-inline">
                <input type="checkbox" name="rememberme" title="记住密码" lay-skin="primary" checked>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-inline-block">
                <button class="layui-btn" style="width: 190px;" lay-submit="" lay-filter="login">登录</button>
            </div>
        </div>
    </form>
</div>

<script src="http://localhost:8085/youxia/layui/layui.all.js"></script>
<script type="text/javascript">
    layui.use(['form', 'layedit', 'laydate'], function () {
        var form = layui.form
            , layer = layui.layer
            , layedit = layui.layedit
            , laydate = layui.laydate;

        form.on('submit(login)', function (data) {
            /*$("form").submit(function(e){
                alert("Submitted");
            });*/
           /* $.ajax({
                url: "http://localhost:8085/youxia/login",
                dataType: "json",
                type: "POST",
                xhrFields: {
                    withCredentials: true // 这里设置了withCredentials
                },
                data: {
                    "username": data.field.username,
                    "password": data.field.password,
                    "rememberme": data.field.rememberme
                },
                success: function (data) {
                    console.log(data);
                    if (data.data.code == 0 || data.data.code == 302) {
                        window.location.href = data.data.url;
                    }
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    debugger;
                    console.log(textStatus);
                },
                complete: function (XMLHttpRequest) {
                    debugger;
                }
            })*/
            return true;
        });
    })
</script>
</body>
</html>